package cn.com.connext.scrm.repository.master;


import cn.com.connext.scrm.domain.master.ActivityModule;
import cn.com.connext.scrm.domain.master.ActivityModuleConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface ActivityModuleRepository extends JpaRepository<ActivityModule, Long>, JpaSpecificationExecutor {
    List<ActivityModule> findByActivityId(@Param("activityId")String activityId);
    @Modifying
    @Query(value = "delete from activity_module where  id  not in :list and activity_id = :activityId ", nativeQuery = true)
    void deleteByCondition(@Param("list")List<Long> list,@Param("activityId")String activityId);
    @Modifying
    @Query(value = "delete from activity_module where  activity_id = :activityId ", nativeQuery = true)
    void deleteByActivityId(@Param("activityId")String activityId);
}
